﻿using IntelligentAgriculture.Contracts.Dto.Output;
using IntelligentAgriculture.Contracts.Interface;
using IntelligentAgriculture.Domain.Entity;
using IntelligentAgriculture.WebAPI.Application.Command.DeliveryPromptModelCommand;
using IntelligentAgriculture.WebAPI.Controllers;
using MediatR;

namespace IntelligentAgriculture.WebAPI.Application.CommandHandler.DeliveryPromptModelHandler
{
    public class DeliveryPromptModelGetCommandHandler : IRequestHandler<DeliveryPromptModelGetCommand, PageOutput<DeliverypromptmodelOutput>>
    {
        private readonly IDeliveryPromptModelService _deliveryPromptModelService;
        public DeliveryPromptModelGetCommandHandler(IDeliveryPromptModelService deliveryPromptModelService)
        {
            _deliveryPromptModelService= deliveryPromptModelService;
        }

        public async Task<PageOutput<DeliverypromptmodelOutput>> Handle(DeliveryPromptModelGetCommand request, CancellationToken cancellationToken)
        {
            var result = await _deliveryPromptModelService.GetDeliveryPromptModel(request.pageIndex, request.pageSize);
            return result;
        }
    }
}
